import { $axios } from "../http/request"

// 获取文章分类列表
export const articleCatesRequest = () => {
  return $axios({
    url: '/my/article/cates',
    method: 'get',
  })
}

// 新增文章分类
export const addArticleCatesRequest = (data) => {
  return $axios({
    url: '/my/article/addcates',
    method: 'post',
    data
  })
}

// 删除文章分类
export const deleteArticleCatesRequest = (id) => {
  return $axios({
    url: `/my/article/deletecate/${id}`,
    method: 'get',
  })
}

// 更新文章分类
export const updateArticleCatesRequest = (data) => {
  return $axios({
    url: '/my/article/updatecate',
    method: 'post',
    data
  })
}

// 发布新文章
export const addArticleRequest = (data) => {
  return $axios({
    url: '/my/article/add',
    method: 'post',
    data
  })
}

// 获取文章列表
export const getArticleListRequest = (params) => {
  return $axios({
    url: '/my/article/list',
    method: 'get',
    params
  })
}

// 获取文章详情
export const getArticleDetailRequest = (id) => {
  return $axios({
    url: `/my/article/${id}`,
    method: 'get'
  })
}

// 更新文章信息
export const updateArticleRequest = (data) => {
  return $axios({
    url: `/my/article/edit`,
    method: 'post',
    data
  })
}